package BitManipulation;

public class _371_SumofTwoIntegers {
    public int getSum_0(int a, int b) {
        return a + b;
    }

    public int getSum(int a, int b) {
        int carry = a & b;
        int notCarrySum = a ^ b;
        while (carry!=0) {
            int tempA = notCarrySum;
            int tempB = carry << 1;
            carry = tempA & tempB;
            notCarrySum = tempA ^ tempB;
        }
        return notCarrySum;
    }
}
